package com.ugoodtech.mdcc.client.controller.ResponseObject;

import com.ugoodtech.mdcc.core.Constants;
import com.ugoodtech.mdcc.core.domain.Station;
import com.ugoodtech.mdcc.core.domain.StationReport;
import org.apache.commons.lang3.StringUtils;

import java.text.SimpleDateFormat;

public class PaintResponse {

    private SimpleDateFormat simpleDateFormat = new SimpleDateFormat(Constants.DEFAULT_DATE_FORMAT);

    private Long stationId = 0L;

    private Long reportId = 0L;

    private String stationName = "";

    private String address = "";

    private String userName = "";

    private String dateTime = "";

    private String isPaint = "";

    private String category = "";

    private String editUserName = "";

    private int isPaintInt = 0;

    public PaintResponse(Station station, boolean isPaint, String realName) {
        super();
        if (isPaint == false) {
            this.isPaint = "未填写";
        }
        this.stationId = station.getId();
        this.stationName = station.getName();
        if (StringUtils.isNotEmpty(realName)) {
            this.userName = realName;
        }
        String province = "";
        String city = "";
        if (StringUtils.isNotEmpty(station.getProvince())) {
            province = station.getProvince();
        }
        if (StringUtils.isNotEmpty(station.getCity())) {
            city = station.getCity();
            if (province.equals(city)) {
                this.address = province;
            } else {
                this.address = province + city;
            }
        }
        this.dateTime = simpleDateFormat.format(station.getUpdateTime()).toString();
        this.category = station.getCategory();
    }

    public PaintResponse(StationReport report, boolean isPaint, String realName) {
        if (isPaint == true) {
            this.isPaint = "已填写";
            this.isPaintInt = 1;
        }
        this.stationId = report.getStation().getId();
        this.reportId = report.getId();
        this.stationName = report.getStation().getName();
        if (StringUtils.isNotEmpty(realName)) {
            this.userName = realName;
        }
        String province = "";
        String city = "";
        if (StringUtils.isNotEmpty(report.getStation().getProvince())) {
            province = report.getStation().getProvince();
        }
        if (StringUtils.isNotEmpty(report.getStation().getCity())) {
            city = report.getStation().getCity();
            if (province.equals(city)) {
                this.address = province;
            } else {
                this.address = province + city;
            }
        }
        this.dateTime = simpleDateFormat.format(report.getUpdateTime()).toString();
        this.category = report.getStation().getCategory();
    }

    public Long getStationId() {
        return stationId;
    }

    public void setStationId(Long stationId) {
        this.stationId = stationId;
    }

    public Long getReportId() {
        return reportId;
    }

    public void setReportId(Long reportId) {
        this.reportId = reportId;
    }

    public String getStationName() {
        return stationName;
    }

    public void setStationName(String stationName) {
        this.stationName = stationName;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getDateTime() {
        return dateTime;
    }

    public void setDateTime(String dateTime) {
        this.dateTime = dateTime;
    }

    public String getIsPaint() {
        return isPaint;
    }

    public void setIsPaint(String isPaint) {
        this.isPaint = isPaint;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public int getIsPaintInt() {
        return isPaintInt;
    }

    public void setIsPaintInt(int isPaintInt) {
        this.isPaintInt = isPaintInt;
    }

    public String getEditUserName() {
        return editUserName;
    }

    public void setEditUserName(String editUserName) {
        this.editUserName = editUserName;
    }
}
